﻿<Application x:Class="PatientsPackage.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="MainWindow.xaml">
   <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/DTC;component/Resources/ButtonsStyles.xaml"/>
                <ResourceDictionary Source="/DTC;component/Resources/Brushes.xaml"/>
                <ResourceDictionary Source="/DTC;component/Resources/BorderStyles.xaml"/>
                <ResourceDictionary Source="/DTC;component/Resources/ToolTipStyles.xaml"/>
                <ResourceDictionary Source="/DTC;component/Resources/TreeViewStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Style x:Key="PopupBorder" TargetType="{x:Type Border}">
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="BorderBrush" Value="Gray" />
                <Setter Property="Background" Value="{StaticResource WindowHeaderColor}" />
                <Setter Property="CornerRadius" Value="10,10,17,17"/>
            </Style>
            <Style x:Key="PopupGridStyle" TargetType="{x:Type Grid}">
                <Setter Property="HorizontalAlignment" Value="Stretch"/>
            </Style>
            <Style x:Key="PopupColumnStyle" TargetType="{x:Type ColumnDefinition}">
                <Setter Property="Width" Value="*"/>
            </Style>
            <Style x:Key="PopupTopRowStyle" TargetType="{x:Type RowDefinition}">
                <Setter Property="Height" Value="21"/>
            </Style>
            <Style x:Key="PopupMiddleRowStyle" TargetType="{x:Type RowDefinition}">
                <Setter Property="Height" Value="*"/>
            </Style>
            <Style x:Key="PopupBottomRowStyle" TargetType="{x:Type RowDefinition}">
                <Setter Property="Height" Value="33"/>
            </Style>
            <Style x:Key="PopupWindow" TargetType="{x:Type Window}">
                <Setter Property="AllowsTransparency" Value="True" />
                <Setter Property="WindowStyle" Value="None" />
                <Setter Property="Background" Value="{StaticResource WindowBackground}" />
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="ShowInTaskbar" Value="False"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Window}">
                            <Border>
                                <Border Style="{StaticResource PopupBorder}" Margin="30">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FF515984" Offset="1"/>
                                            <GradientStop Color="#FF8F99D5" Offset="0"/>
                                            <GradientStop Color="#FF4F5573" Offset="0.406"/>
                                            <GradientStop Color="#FF7078A7" Offset="0.768"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Border.BitmapEffect>
                                        <DropShadowBitmapEffect Color="Black" Opacity="0.6" Direction="320" ShadowDepth="0.5" Softness="1"/>
                                    </Border.BitmapEffect>
                                    <Grid Style="{StaticResource PopupGridStyle}" Margin="0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Style="{StaticResource PopupColumnStyle}"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Style="{StaticResource PopupTopRowStyle}"/>
                                            <RowDefinition Style="{StaticResource PopupMiddleRowStyle}"/>
                                            <RowDefinition Style="{StaticResource PopupBottomRowStyle}"/>
                                        </Grid.RowDefinitions>
                                        <Grid MouseLeftButtonDown="StackPanel_MouseLeftButtonDown"  Grid.Row="0" Margin="0" HorizontalAlignment="Stretch">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="17"/>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="17"/>
                                            </Grid.ColumnDefinitions>

                                            <Border Opacity="1" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="0,0,1,1"/>
                                            <TextBlock Grid.Column="1" Width="Auto"
												HorizontalAlignment="Center" 
												Background="Transparent" 
												Text="{TemplateBinding Title}"
												Foreground="Black"
												FontSize="12"
												FontWeight="Bold"/>
                                        </Grid>
                                        <Border BorderThickness="1" CornerRadius="6" Margin="4" Grid.Row="1" Background="{TemplateBinding Background}">
                                            <Border.BorderBrush>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="#FF535353" Offset="1"/>
                                                    <GradientStop Color="#FFA5A5A5" Offset="0"/>
                                                </LinearGradientBrush>
                                            </Border.BorderBrush>
                                            <AdornerDecorator>
                                                <ContentPresenter IsHitTestVisible="True" 
                                                          HorizontalAlignment="Stretch" 
                                                          VerticalAlignment="Stretch" 
                                                          Focusable="True"/>
                                            </AdornerDecorator>
                                        </Border>
                                        <Grid Grid.Row="2" Margin="3,0,3,0">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="0.5*"/>
                                                <ColumnDefinition Width="0.5*"/>
                                            </Grid.ColumnDefinitions>
                                            <Button x:Name="AcceptBtn" 
												Style="{StaticResource AcceptButton}" 
												Grid.Column="0" Height="23" 
												Margin="2,1,3,0"
												Click="AcceptBtn_Click" 
												FontSize="12" FontWeight="Bold" 
												VerticalAlignment="Top">Принять</Button>
                                            <Button x:Name="CancelBtn" 
												Style="{StaticResource CancelButton}" 
												Grid.Column="1" Height="23" 
												Margin="3,1,2,0"
												Click="CloseButton_Click" 
												FontSize="12" FontWeight="Bold" 
												VerticalAlignment="Top">Отменить</Button>
                                        </Grid>
                                    </Grid>
                                </Border>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="{x:Type Control}">
                <Setter Property="Focusable" Value="False"/>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>
